import com.test.web.Browsers;
import com.test.web.WebsBase;
import com.test.web.entity.LoginEntity;
import com.test.web.enums.FindTypeEnum;
import com.test.web.suite.LoginLocation;
import com.test.web.suite.SuiteMethods;
import com.test.web.testng.LogCustomListener;
import org.openqa.selenium.By;
import org.openqa.selenium.SessionNotCreatedException;
import org.testng.annotations.*;

import java.lang.reflect.Method;
import java.util.Map;


@Listeners(LogCustomListener.class)
public class startWeb extends WebsBase{

    @BeforeSuite
    public void setBrowser(){
//        try {
//            super.setBrowser(Browsers.Chrome,null);
//        }catch (SessionNotCreatedException e){
//            System.exit(1);
//        }
    }

    //每个测试执行前等待500ms
    @BeforeMethod
    public void beforeMethod(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    //每个测试执行后等待500ms
    @AfterMethod
    public void afterMethod(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    //@LoginLocation(locationType = {FindTypeEnum.ID,FindTypeEnum.ID,FindTypeEnum.ID,FindTypeEnum.ID,FindTypeEnum.ID},locationKey = {"userName","password","login","code","rand"},hasTest = false,checkIsWork=true)
    @Test(invocationCount = 1)
    public void test1() {
//        super.openUrl("https://mpf.aichel.com/");
        //super.sendKey(By.id("userName"),"shell");
//        super.sendKey(By.id("password"),"1234qweasd");
//        getDriver().findElement(By.id("code"));
//        super.sendKey(By.id("rand"),"111");
//        SuiteMethods suite=new SuiteMethods();
//        suite.loginTest(super.getDriver());
        //super.click(By.id("aa"));
        LoginEntity login=new LoginEntity();
        login.setUserValue(By.id("luwei"));
        login.st

    }

    @AfterSuite
    public void quitBrowser(){
        super.quit();
    }
}
